package com.ellecity06.cwhiskymall.utils

import android.content.Intent
import android.os.Process
import com.ellecity06.common.utils.appContext
import com.ellecity06.cwhiskymall.ui.splash.SplashActivity
import kotlin.system.exitProcess

/**
 * @author ellecity06
 * @time 2024/11/6 18:30
 * @des
 */
class AppTools {
    companion object{
         fun restartApplication() {
            val intent = Intent(appContext, SplashActivity::class.java) // 替换成你的主Activity
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_NEW_TASK)
            appContext.startActivity(intent)

            // 结束当前进程
            Process.killProcess(Process.myPid())
            exitProcess(1)
        }
    }
}